<template>
  <div>
    <el-card>
      <CategorySelector @categoryChange="handleCategoryChange"></CategorySelector>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'CategoryList',
  data () {
    return {
      category1Id: null, // 一级分类ID
      category2Id: null,  // 二级分类ID
      category3Id: null,  // 三级分类ID
    }
  },
  methods: {
    handleCategoryChange ({categoryId, level}) {
      console.log('handleCategoryChange', categoryId, level)
      if (level===1) {
        this.category1Id = categoryId
      } else if (level===2) {
        this.category2Id = categoryId
      } else {
        this.category3Id = categoryId
        alert('发请求, 获取对应的属性列表')
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
